package com.zx.feign;/**
 * Author:JasonZ
 * Data:2023/4/20
 */

import com.zx.common.ResponseCommon;
import com.zx.feign.fallBack.AddressClientHystrix;
import com.zx.vo.AddressInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @program: ecommerce-parent
 * @description:如果发生异常就进行熔断 fallback
 * @author: JasonZ
 * @create: 2023-04-20 19:44
 **/
//  addressClient.getAddressInfoById(2); ----->  restTemplate.exchange(http://account-service/account-service/address/get-address-by-id/{id}  xxxxx)
//fallback 指定熔断之后返回对象
@FeignClient(value = "account-service",fallback = AddressClientHystrix.class)
public interface SecuredAddressClient {
    /*根据地址id查询地址信息*/
    @RequestMapping(value = "/account-service/address/get-address-by-id/{id}", method = RequestMethod.GET)
    ResponseCommon<AddressInfo> getAddressInfoById(@PathVariable("id") Long id);
}
